home *** CD-ROM | disk | FTP | other *** search
- property iOriginX, iOriginY, iButtonSize, iButtonArea, iButtonAreaRect, iOffsetLeft, iOffsetTop, iButtonRectList, iButtonOrigin, iPreviousSelectedKeyword
- global theSparkle, theBlitPict, objIndexBtn, objBookmark, gallchapterlist, gIndexParagraphField, gGraphicPath, gFileName, gSpriteSetList, gNextPlay, gQuick, gKeywordDataList, gSelLine
-
- on birth me
- set iButtonSize to 12
- set tMaxH to 27
- set tMaxV to 23
- set iOriginX to 151
- set iOriginY to 114
- set iButtonArea to iOriginX & "," & iOriginY & "," & iOriginX + (iButtonSize * tMaxH) & "," & iOriginY + (iButtonSize * tMaxV)
- set iButtonAreaRect to BoxToRect(iButtonArea)
- set iOffsetLeft to iOriginX - iButtonSize
- set iOffsetTop to iOriginY - iButtonSize
- set iButtonOrigin to rect(iOffsetLeft, iOffsetTop, iOriginX, iOriginY)
- set pictfilepath to gGraphicPath & getProp(gFileName, #INDEXBTN)
- blitPictInitFile(objIndexBtn, pictfilepath)
- set iButtonRectList to [:]
- addProp(iButtonRectList, #NORMAL, "0,0,12,12")
- addProp(iButtonRectList, #VISITED, "324,0,336,12")
- addProp(iButtonRectList, #NORMAL_SELECTED, "336,0,348,12")
- addProp(iButtonRectList, #VISITED_SELECTED, "336,0,348,12")
- set iPreviousSelectedKeyword to gSelLine
- return me
- end
-
- on mStartIndex me
- repeat with tChapter = 1 to mGetMaxChapter(objBookmark)
- set tMaxParagraphs to mGetMaxParagraph(objBookmark, tChapter)
- mDrawNormalButtons(me, tChapter, tMaxParagraphs)
- repeat with tParagraph = 1 to tMaxParagraphs
- set tButtonStatus to mGetStatus(objBookmark, tChapter, tParagraph)
- if tButtonStatus <> #NORMAL then
- mDrawButton(me, tChapter, tParagraph, tButtonStatus)
- end if
- end repeat
- end repeat
- end
-
- on mDrawNormalButtons me, tChapterLine, tMaxParagraphs
- set tSrcRect to BoxToRect("0,0," & iButtonSize * tMaxParagraphs & "," & iButtonSize)
- set tDestRect to RectToBox(offset(tSrcRect, iOriginX, iOffsetTop + (tChapterLine * iButtonSize)))
- blitPictDrawScreen(objIndexBtn, RectToBox(tSrcRect), tDestRect, "copy", 0, 0)
- end
-
- on mDrawButton me, tChapter, tParagraph, tButtonStatus
- set tSrcRect to getaProp(iButtonRectList, tButtonStatus)
- set tDestRect to RectToBox(offset(iButtonOrigin, tParagraph * iButtonSize, tChapter * iButtonSize))
- blitPictDrawScreen(objIndexBtn, tSrcRect, tDestRect, "copy", 0, 0)
- end
-
- on mDrawKeywords me, tSelectedKeyword
- if iPreviousSelectedKeyword > 0 then
- repeat with keywordData in getAt(gKeywordDataList, iPreviousSelectedKeyword)
- set tChapter to getAt(keywordData, 1)
- set tParagraph to getAt(keywordData, 2)
- set tButtonStatus to mGetStatus(objBookmark, tChapter, tParagraph)
- mDrawButton(me, tChapter, tParagraph, tButtonStatus)
- end repeat
- end if
- set iPreviousSelectedKeyword to tSelectedKeyword
- repeat with keywordData in getAt(gKeywordDataList, tSelectedKeyword)
- set tChapter to getAt(keywordData, 1)
- set tParagraph to getAt(keywordData, 2)
- set tButtonStatus to value("#" & mGetStatus(objBookmark, tChapter, tParagraph) & "_SELECTED")
- mDrawButton(me, tChapter, tParagraph, tButtonStatus)
- end repeat
- end
-
- on mMouseUp me
- set tParagraph to (getAt(clickLoc(), 1) - iOffsetLeft) / iButtonSize
- set tChapter to (getAt(clickLoc(), 2) - iOffsetTop) / iButtonSize
- if (tChapter > 0) and (tParagraph > 0) and (tChapter <= mGetMaxChapter(objBookmark)) then
- if tParagraph <= mGetMaxParagraph(objBookmark, tChapter) then
- sparkle(theSparkle, clickLoc())
- repeat with tSprite in getAt(gSpriteSetList, 3)
- set the visible of sprite tSprite to 0
- end repeat
- if gQuick then
- set gNextPlay to [tChapter, tParagraph, #play]
- else
- set gNextPlay to [tChapter, tParagraph, #pause]
- end if
- set the mouseDownScript to "playerMouseDownScript"
- go("PlayMode")
- else
- beep()
- end if
- else
- beep()
- end if
- end
-
- on mRollOver me
- end
-